﻿using JGSY.DotNetty.Server.Core;
using JGSY.NotNetty.ControllerBus;
using Microsoft.Extensions.DependencyInjection;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Text;
using System.Threading.Tasks;

namespace JGSY.DotNetty.Server.CoreImpl
{

    public static class ServerCoreImplDIExtension
    {
        /// <summary>
        /// 添加依赖注入服务
        /// </summary>
        /// <param name="services"></param>
        public static void AddServer(this IServiceCollection services)
        {
            services.AddScoped<IDotNettyServer, DotNettyServerImpl>();
            services.AddTransient<ChannelHandler>();
            services.AddTransient<WebSocketHandler>();
            services.AddTransient<WebAPIHandler>();
            services.AddTransient<FileHandler>(); 

            services.AddControlerBus(Assembly.Load("JGSY.DotNetty.Controlers"));

        }
    }
}
